
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;
using System.Diagnostics;
using System.Xml;

using Swaf;


namespace Swaf.Gui
{
	/// <summary>
	/// Summary description for BaseGuiWidget.
	/// </summary>
	public class BaseGuiWidget : IGuiWidget, ILayoutTemplateHandler
	{
		protected XmlElement m_origionalTemplate;
		protected ILayoutManager m_parentLayout;

		public BaseGuiWidget()
		{
			//Intentionally left blank.
		}

		public virtual GuiType WidgetType {get{return GuiType.Unknown;}}

		public virtual void disableUpdate()
		{
			// TODO:  Add BaseGuiWidget.disableUpdate implementation
		}

		public virtual void addObserver(string eventName, Delegate observer)
		{
			// TODO:  Add BaseGuiWidget.addObserver implementation
		}

		public virtual void enableUpdate()
		{
			// TODO:  Add BaseGuiWidget.enableUpdate implementation
		}

		public virtual ILayoutManager ParentLayout
		{
			get
			{
				return m_parentLayout;
			}
			set
			{
				m_parentLayout = value;
			}
		}

		public virtual void removeObserver(string eventName, Delegate observer)
		{
			// TODO:  Add BaseGuiWidget.removeObserver implementation
		}

		public virtual void show(ILocation location)
		{
			// TODO:  Add BaseGuiWidget.show implementation
		}

		public virtual void hide()
		{
			// TODO:  Add BaseGuiWidget.hide implementation
		}

		public string Id
		{
			get
			{
				return m_origionalTemplate==null?"":m_origionalTemplate.GetAttribute("id");
			}
		}

		public virtual string ShortName
		{
			get
			{
				return m_origionalTemplate==null?"":m_origionalTemplate.GetAttribute("name");
			}
		}

		public virtual string Description
		{
			get
			{
				return m_origionalTemplate==null?"":m_origionalTemplate.GetAttribute("description");
			}
		}

		public virtual string MediumName
		{
			get
			{
				return m_origionalTemplate==null?"":m_origionalTemplate.GetAttribute("mediumName");
			}
		}

		public virtual string ValueProperty
		{
			get
			{
				// TODO:  Add BaseGuiWidget.ValueProperty getter implementation
				return null;
			}
		}

		public virtual object Ctl
		{
			get
			{
				// TODO:  Add BaseGuiWidget.Ctl getter implementation
				return null;
			}
		}

		public virtual NumericPair MinimumSize(object parentContext)
		{
			return new NumericPair();
		}

		public virtual void sizePositionTo(Rect r)
		{
			// TODO:  Add BaseGuiWidget.sizePositionTo implementation
		}
		#region ILayoutTemplateHandler Members

		public virtual XmlElement LayoutTemplate
		{
			get
			{
				return m_origionalTemplate;
			}
			set
			{
				m_origionalTemplate = value;
			}
		}

		#endregion
	}
}
